Release 10.1A: OpenEdge Data Management:
SQL Reference
FETCH
Moves the position of the cursor to the next row of the active set and fetches the column values of the current row into the specified host variables.
Syntax
cursor_nameA name identified in an earlier
DECLARECURSORstatement and anOPENCURSORstatement.USING SQL DESCRIPTOR structure_nameDirects the SQL engine to
FETCHdata into storage addressed by an SQLDA structure.INTO :host_var_ref [ [ INDICATOR ] :ind_var_ref ]Directs the SQL engine to
ExampleFETCHdata into the identified host variables, and to set values in the identified indicator variables.
Notes
- A
FETCHoperation requires that the cursor be open.- The positioning of the cursor for each
FETCHoperation is as follows:
- The first time you execute a
FETCHstatement after opening the cursor, the cursor is positioned to the first row of the active set.- Subsequent
FETCHoperations advance the cursor position in the active set. The next row becomes the current row.- When the current row is deleted using a positioned
DELETEstatement, the cursor is positioned before the row after the deleted row in the active set.- The cursor can only be moved forward in the active set by executing
FETCHstatements. To move the cursor to the beginning of the active set, you mustCLOSEthe cursor andOPENit again.- If the cursor is positioned on the last row of the active set or if the active set does not contain any rows, executing a
FETCHwill return the status codeSQL_NOT_FOUNDin the SQLDA.- After a successful
FETCH, the total row count fetched so far for this cursor is returned insqlca.sqlerrd[2]. The count is set to zero after anOPENcursor operation.- You can
FETCHmultiple rows in oneFETCHoperation by using array variables in theINTOclause. TheSQL_NOT_FOUNDstatus code is returned in theSQLCAwhen the end of the active set is reached, even if the currentFETCHstatement returns one or more rows.- If you use array variables in a
FETCHstatement, the array sizes are set to the number of rows fetched after theFETCHstatement is executed.Authorization
None
Related statements
DECLARE CURSOR, OPEN, CLOSE
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |